<script lang="ts" setup>
   import {useRouter} from 'vue-router'
    //注意不是useRoute而是useRouter
    const router = useRouter()
    defineProps(['id','title','content'])
</script>
<template>
    <div>
         <!-- 表示在历史堆栈中前进或后退多少步 -->
        <button @click="router.go(1)">前进一个</button>
        <button @click="router.go(-1)">后退1个</button>
        <h3>新闻id:{{ id }}</h3>
        <h3>新闻title:{{ title}}</h3>
        <h3>新闻content:{{ content || '暂时没有新闻'}}</h3>
    </div>
</template>